package com.jk.controller;


import com.jk.bean.Content;
import com.jk.bean.Finance;
import com.jk.bean.Page;
import com.jk.bean.SendPage;
import com.jk.service.BooService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("boo")
public class BooController {

    @Resource
    private BooService booService;
   //===财经
    @ResponseBody
    @RequestMapping("queryBoo")
    public SendPage queryBoo(Page page,String name){
        SendPage pag =booService.queryBoo(page,name);
        return pag;
    }

    @ResponseBody
    @RequestMapping("getAllTables")
    public List<Finance>  getAllTables(){
        List<Finance>  list=booService.getAllTables();
        return list;
    }


    @RequestMapping("toUrl")
    private String toUrl(String name,Model  mo){
       mo.addAttribute("name",name);
       return "caijing";
    }


    @ResponseBody
    @RequestMapping("queryXqing")
    public List<Content> queryXqing(String name, String tablename){


        return  booService.queryXqing(name, tablename);

    }

    @RequestMapping("toString")
    public String toString(String pid,String tablename, Model mo){

        mo.addAttribute("name",pid);
        mo.addAttribute("biaoMing",tablename);
        return "/detailsPage";
    }

    //===详情页面的参数
    @ResponseBody
    @RequestMapping("getBoo")
    public Finance getBoo(String id,String name){
        return booService.getBoo(id,name);
    }

}
